 <ul class="thumbs_list">
    <?php foreach ($gallery as $row){?>
        <li> <a href="<?php echo $row->title;?>" target="_blank">
            <img src="images/phocagallery/<?php echo $row->filename;?>" alt=""/></a>
        <div> <a href="<?php echo $row->title;?>" target="_blank"><?php echo $row->title;?></a></div>
        </li>
    <?php }?>
</ul>